<p>When all the keys of a Map are values from the same enum, the <code>Map</code> can be replaced with an <code>EnumMap</code>, which can be much more
efficient than other sets because the underlying data structure is a simple array.</p>
<h2>Noncompliant Code Example</h2>
<pre>
public class MyClass {

  public enum COLOR {
    RED, GREEN, BLUE, ORANGE;
  }

  public void mapMood() {
    Map&lt;COLOR, String&gt; moodMap = new HashMap&lt;COLOR, String&gt; ();
  }
}
</pre>
<h2>Compliant Solution</h2>
<pre>
public class MyClass {

  public enum COLOR {
    RED, GREEN, BLUE, ORANGE;
  }

  public void mapMood() {
    EnumMap&lt;COLOR, String&gt; moodMap = new EnumMap&lt;&gt; (COLOR.class);
  }
}
</pre>

